<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div>
    <img src="https://source.unsplash.com/random/800x600" alt="">
  </div>
  <script>
    // 写一个图片的数组
    const imgArr = [
      "https://picsum.photos/800/600",
      "https://placebear.com/800/600",
      "https://baconmockup.com/800/600"
    ];
    // 随机获取一个图片
    const random = Math.floor(Math.random() * imgArr.length);
    // 获取box元素
    const box = document.querySelector('img');
    // 修改box的src属性
    box.src = imgArr[random];
  </script>
</body>
</html>